
<div id="main">
<div id="contents">
<form method="post" action="#" name="filters" id="form">
<fieldset>
<legend>&nbsp;<label sid="lan.setup" ></label>&nbsp;</legend>
<div class="frame_tab_layer">
	
            <table width="100%" cellspacing="0" cellpadding="0" border="0" class="cmenutitle">
            <tbody><tr>
              <td class="frame_tab_left"><label for="id2073"><label sid="inet.ip"></label></label>
              </td>
              <td class="frame_tab_right">
                  <input type="text" maxlength="15" size="17" id="id2073" name="id2073">
                  <span class="x-form-tip" id="id2073Tip"></span>
              </td>
            </tr>
            <tr>
              <td class="frame_tab_left"><label for="id2074"><label sid="inet.netmask" ></label></label>
              </td>
              <td class="frame_tab_right">
                  <input type="text" maxlength="15" size="17" id="id2074" name="id2074">
                  <span class="x-form-tip" id="id2074Tip"></span>
              </td>
            </tr>
            <tr>
              <td class="frame_tab_left"><label for="id2020"><label sid="inet.mac" ></label></label>
              </td>
              <td class="frame_tab_right"><input type="text" readonly="true" maxlength="17" size="17" id="id2020" name="id2020" style="background-color: rgb(204, 204, 204);"></td>
            </tr>
            <tr><td colspan="2"></td></tr>
            <tr>
				<td colspan="2" class="frame_tab_center">
					<input type="button" sid="sbutton.save" value="" name="submit1" class="button" id="submit1">
				</td>
			</tr>
          </tbody></table>
            </div>
		</fieldset>
</form>
<form>
<fieldset>
<legend>&nbsp;<label sid="lan.title2" ></label></legend>
<div class="frame_tab_layer">
  <!--L2TP-->
           <table width="100%" cellspacing="0" cellpadding="0" border="0" class="cmenutitle">
             <tbody><tr>
              <td class="frame_tab_left"><label for="id2089"><label sid="lan.stp" ></label></label>
              </td>
              <td class="frame_tab_right"><input type="radio" value="1" id="id2089_1" name="id2089">&nbsp;<label sid="main.enable" ></label><span style="padding-left:20px;"></span><input type="radio" checked="" value="0" id="id2089_2" name="id2089">&nbsp;<label sid="main.disable" ></label></td>
            </tr>
             <tr>
              <td class="frame_tab_left"><label for="id2090"><label sid="lan.lltd" ></label></label>
              </td>
              <td class="frame_tab_right"><input type="radio" value="1" id="id2090_1" name="id2090">&nbsp;<label sid="main.enable" ></label><span style="padding-left:20px;"></span><input type="radio" checked="" value="0" id="id2090_2" name="id2090">&nbsp;<label sid="main.disable" ></label></td>
            </tr>
            <tr>
              <td class="frame_tab_left"><label for="id2091"><label sid="lan.igmpp" ></label> </label>
              </td>
              <td class="frame_tab_right"><input type="radio" value="1" id="id2091_1" name="id2091">&nbsp;<label sid="main.enable" ></label><span style="padding-left:20px;"></span><input type="radio" checked="" value="0" id="id2091_2" name="id2091">&nbsp;<label sid="main.disable" ></label></td>
            </tr>
            <tr>
              <td class="frame_tab_left"><label for="id2094">
              	<label sid="lan.pppoer" ></label>
            </label>
              </td>
              <td class="frame_tab_right"><input type="radio" value="1" id="id2094_1" name="id2094">&nbsp;<label sid="main.enable" ></label><span style="padding-left:20px;"></span><input type="radio" checked="" value="0" id="id2094_2" name="id2094">&nbsp;<label sid="main.disable" ></label></td>
            </tr>
             <tr><td colspan="2"></td></tr>
            <tr>
				<td colspan="2" class="frame_tab_center">
				<input type="button" sid="sbutton.save" name="submit" class="button" id="submit2">
				</td>
			</tr>
          </tbody></table>
</div>
</fieldset>
</form>
</div>
</div>
</br>
<div id="helpContainer" style="height: 700px;">
<div id="help">
    <div><h2><img border="0" src="images/help_title.png"><label sid="share.help" ></label></h2></div>
    <div id="helpBody">
    <dl>
        <dt class="term">
            <label sid="inet.ip" ></label>
        </dt>
        <dd class="definition">
            <label sid="lan.ipRange" ></label>
        </dd>
        <dt class="term">
            <label sid="lan.stp" ></label>
        </dt>
        <dd class="definition">
            <label sid="lan.stp_note" ></label>
        </dd>
        <dt class="term">
            <label sid="lan.lltd" ></label>
        </dt>
        <dd class="definition">
            <label sid="lan.lltd_note" ></label>
        </dd>
        <dt class="term"> <label sid="lan.igmpp" ></label></dt>
        <dd class="definition"><label sid="lan.igmpp_note" ></label></dd>
        <dt class="term"><label sid="lan.pppoer" ></label></dt>
        <dd class="definition"><label sid="lan.pppoer_note" ></label></dd>
    </dl>
    </div>


</div>
</div>
<script type="text/javascript">
      $(document).ready(function(){

          $.formValidator.initConfig({debug:false,submitOnce:true,submitButtonID:"submit1",
              onError:function(msg, obj, errorlist) {

              },
              onSuccess:function(){
                  if($.trim(value2025)!==""&&$.trim(value2026)!==""){
                      if(checkNet($("#id2073").val(),$("#id2074").val(),value2025,value2026)==2){
                          alert(msg.lanip_wanip);
                      }else if(checkNet($("#id2073").val(),$("#id2074").val(),value2025,value2026)==3){
                          fun_submit();
                      }else if(checkNet($("#id2073").val(),$("#id2074").val(),value2025,value2026)==1){
                          alert(msg.invalid_ip);
                      }
                  }else{
                      fun_submit();
                  }
              }
          });
          $("#id2073").formValidator({
              onFocus:errmsg.Info9
          }).regexValidator({
              regExp:regexEnum.notempty,
              onError:errmsg.Info3

          }).regexValidator({
                      regExp:regexEnum.ip4,
                      onError:errmsg.Info1

                  }).functionValidator({
                      fun : function(){
                         var inputIP =$("#id2073").val();
                         var inputIPs =inputIP.split(".");
                         var inputIPs_1 =inputIPs[0];
                         if(inputIPs_1==10 ||inputIPs_1== 172 ||inputIPs_1 == 169 ||inputIPs_1==192){
                             var flag =true;
                             var obj  = {
                                 init : function(){

                                 },
                                 condition : "",
                                 excute:function(){
                                     this[this.condition].apply(this);
                                 },
                                 10:function(){
                                     flag =  invalideVal(inputIPs,0,255,0,255,0,255);
                                 },
                                 172:function(){
                                     flag = invalideVal(inputIPs,16,31,0,255,0,255);
                                 },
                                 192:function(){
                                     flag = invalideVal(inputIPs,168,168,0,255,0,255);
                                 },
                                 169:function(){
                                     flag= invalideVal(inputIPs,254,254,0,255,0,255);
                                 }

                             }
                             obj.condition = inputIPs_1;
                             obj.excute();
                             this.isValid =flag;
                         }else{
                             this.isValid = false;
                         }

                      },
                      onError:errmsg.Info16

                  });

          function invalideVal(inputIPs,val_1,val_2,tmp_1,tmp_2,name_1,name_2){
              var inputIPs_2 =inputIPs[1];
              var inputIPs_3 =inputIPs[2];
              var inputIPs_4 =inputIPs[3];
                  if(inputIPs_2>= val_1 && inputIPs_2 <= val_2){
                      if(inputIPs_3>=tmp_1 && inputIPs_3 <= tmp_2){
                          if(inputIPs_4>=name_1 &&inputIPs_4<=name_2){
                              return true;
                          }else{
                              return false;
                          }
                      }else{
                          return false;
                      }
                  }else{
                      return false;
                  }


          }


          $("#id2074").formValidator({
              onFocus:errmsg.Info8
          }).regexValidator({
                      regExp:regexEnum.notempty,
                      onError:errmsg.Info3

                  }).regexValidator({
                      regExp:regexEnum.ip4,
                      onError:errmsg.Info1

                  });


          var nonames = new Array("submit","submit1","id2086_0","id2086_1","id2087_0","id2087_1","id2088_1","id2088_0");
          var sendtext = getSendText(nonames);
          var oldip = ''; var value2025='';var value2026='';
          var current_ip = document.URL.split("/")[2];
          sendtext+="&id=2086&id=2087&id=2088&id=2025&id=2026";
          DataRequest("get_json",sendtext,function(data){
              getResult(nonames,data);
              if( $("input[name='id2075']:checked").val()==0){
                  $("#id2076tr").hide();
                  $("#id2077tr").hide();
              }else{
                  $("#id2076tr").show();
                  $("#id2077tr").show();
              }
              oldip = data["id2073"];
              var value2086 = data["id2086"];
              var value2087 = data["id2087"];
              var value2088 = data["id2088"];
              value2025 = data["id2025"];
              value2026 = data["id2026"];

              if(value2086.indexOf(";")>=0){
                  var array2086= value2086.split(";");
                  for(var i =0;i<array2086.length;i++){
                      updatecfgvalue("id2086_"+i,array2086[i]);
                  }
              }else{
                  updatecfgvalue("id2086_0",value2086);
              }
              if(value2087.indexOf(";")>=0){
                  var array2087= value2087.split(";");
                  for(var i =0;i<array2087.length;i++){
                      updatecfgvalue("id2087_"+i,array2087[i]);
                  }
              }else{
                  updatecfgvalue("id2087_0",value2087);
              }
              if(value2088.indexOf(";")>=0){
                  var array2088= value2088.split(";");
                  for(var i =0;i<array2088.length;i++){
                      updatecfgvalue("id2088_"+i,array2088[i]);
                  }
              }else{
                  updatecfgvalue("id2088_0",value2088);
              }
          });
          $("[name=submit]").click(function () {
              $(".errormsg").html('');
              var nonames = new Array("submit","submit1","id2086_0","id2086_1","id2087_0","id2087_1","id2088_1","id2088_0","id2020","id2073","id2074");
              var settext = getSetText(nonames);
              settext=settext.replace(/\#/g,"%23");
              submitform(modules["set_data"],settext);
          });

          function fun_submit(){

              $(".errormsg").html('');
              var settext = "&id2020="+$("#id2020").val()+"&id2073="+$("#id2073").val()+"&id2074="+$("#id2074").val();
              settext=settext.replace(/\#/g,"%23");
              show_message("pro",msg.saving);
              var cannotModify  =  msg.cannotModify1;
              var noPower  =  msg.cannotModify2;
              var success  =  msg.submitSuccess;
              var reboot = msg.restartSuccess;
              var cannotDelete = msg.cannotDelete;
              var cfgError = msg.cfgError;
              $.ajax({
                  type:"POST",url:modules["set_data"],data:settext+"&tmp = "+Math.random(),timeout:25000,dataType:"xml",error:function (XMLHttpRequest,textStatus,errorThrown) {

                      if(textStatus=="timeout"){

                              window.location.href="http://w.com";

                      }
                  },success:function (xml) {
                      $(xml).find('rsp').each(function () {
                          $("#message_panel").fadeOut();
                          $("#lock_div").hide();
                          var stat = $(this).attr('stat');
                          if(stat == "ok") {
                              //show_message("success",success);
                              alert(success);
                          }else if(stat == "restart"||stat == "reboot") {
                              //show_message("success",reboot);
                              alert(reboot);
                              window.location.href="http://w.com";
                          }else if(stat == "fail") {
                              //show_message("err",msg.cfgError);
                              alert(msg.cfgError);
                              $(xml).find('Error').each(function () {
                                  var code = $(this).attr('code');
                                  if(code == 4) {
                                      //show_message("err",cannotModify);
                                      alert(cannotModify);
                                  }else if(code == 5) {
                                      gotologin();
                                  }else {
                                      if($("[name = group]").attr("name")) {
                                          var str = '';
                                          $(xml).find('Error').each(function () {
                                              var code = $(this).attr('code');
                                              if(code == 4) {
                                                  //show_message("err",cannotModify);
                                                  alert(cannotModify);
                                              }else if(code == 5) {
                                                  gotologin();
                                              }else {
                                                  var strArray = $(this).attr('msg').split(" ");
                                                  var mid = strArray[1].substr(2);
                                                  str += mid+",";
                                              }
                                          });
                                          //show_message("err",cannotDelete);
                                          alert(cannotDelete);
                                      }else if($("[name = tra-dis]").attr("name")) {
                                          //show_message("err",dialingRules.help5);
                                          alert(dialingRules.help5);
                                      }else {
                                          var strArray = $(this).attr('msg').split(" ");
                                          var mid = strArray[1].substr(2);
                                          if(mid == 32||mid == 31||mid == 33||mid == 34) {
                                              //show_message("err",cfgError);
                                              alert(cfgError);
                                          }else if($(this).attr('msg').indexOf("line_id")>=0){
                                              var str1=$(this).attr('msg').split(",");
                                              var str2=str1[1].split(" ");
                                              var line_id=str2[1].split("=")[1];
                                              $("#msg"+mid+"_"+line_id).html('<img src="images/check_error.gif">');
                                          }else{
                                              showerror(mid);
                                          }
                                      }
                                  }
                              });
                          }
                      });
                  }
              });
          }




          });


		function lan2_switch(){
		if( $("input[name='id2075']:checked").val()==0){	
  		$("#id2076tr").hide();
  		$("#id2077tr").hide();
  	}else{
  		$("#id2076tr").show();
			$("#id2077tr").show();
  	}
	}
		function disabledServer(){
		if( $("input[name='id2078']:checked").val()==0){

			$("#dhcpconfigid").hide();
		}else{
			$("#dhcpconfigid").show();
		}
	}

	
</script>